Socket
Socket
Sign inDemoInstall

babel-plugin-transform-es2015-parameters

Package Overview
Dependencies
Maintainers
6
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-transform-es2015-parameters

Compile ES2015 default and rest parameters to ES5


Version published
Maintainers
6
Created

What is babel-plugin-transform-es2015-parameters?

The babel-plugin-transform-es2015-parameters package is a Babel plugin that transforms ES2015 (ES6) parameter features to ES5. This includes default parameters, rest parameters, and destructuring in function parameters.

What are babel-plugin-transform-es2015-parameters's main functionalities?

Default Parameters

This feature allows you to set default values for function parameters. If no argument is provided for the parameter, the default value is used.

function greet(name = 'World') { console.log('Hello ' + name); } greet(); // Hello World greet('Alice'); // Hello Alice

Rest Parameters

Rest parameters allow you to represent an indefinite number of arguments as an array. This is useful for functions that need to handle a variable number of arguments.

function sum(...numbers) { return numbers.reduce((acc, num) => acc + num, 0); } console.log(sum(1, 2, 3)); // 6

Destructuring in Parameters

Destructuring in function parameters allows you to unpack values from objects or arrays directly in the parameter list. This can make your code more readable and concise.

function printCoordinates({ x, y }) { console.log(`X: ${x}, Y: ${y}`); } printCoordinates({ x: 10, y: 20 }); // X: 10, Y: 20

Other packages similar to babel-plugin-transform-es2015-parameters

Keywords

FAQs

Package last updated on 07 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc